package com.zxl.always.on.display.ui.widget;

import android.content.Context;
import android.util.AttributeSet;
import android.view.View;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;

import com.zxl.always.on.display.R;

/**
 * Created by Administrator on 2018/3/2.
 */

public class TabItemView extends LinearLayout {

    private View mBgView, mTipsView;

    private ImageView mIconView;

    private TextView mTitleView;

    public TabItemView(Context context, AttributeSet attrs) {
        super(context, attrs);
    }

    @Override
    protected void onFinishInflate() {
        super.onFinishInflate();
        mBgView = findViewById(R.id.settings_custom_tab_bar_button);
        mTipsView = findViewById(R.id.tip);
        mIconView = findViewById(R.id.icon);
        mTitleView = findViewById(R.id.title);
    }

    public void setInfo(int title, int icon) {
        mTitleView.setText(title);
        mIconView.setImageResource(icon);
    }

    public void setChecked(boolean isChecked) {
        mBgView.setBackgroundResource(isChecked ? R.drawable.settings_custom_clock_tab_bar_button_bg_selected : android.R.color.transparent);
        mTipsView.setVisibility(isChecked ? VISIBLE : INVISIBLE);
    }

}
